/**
 * @author: Stephen Halm
 * @date: Nov, 09, 2010
 * @version 0.0.1
 * @class CreditCard
 */
package uicgas.globaldata;

import java.io.Serializable;

/**
 * @author: Stephen Halm
 * @date: Nov, 09, 2010
 * @version 0.0.1
 * @class CreditCard
 */
public class CreditCard extends MessagePayload implements Serializable
{
	private String fullName;
	private String cardNumber;
	private String billingAddress; //this info is not stored on the card why are 
									//we using it.

	public CreditCard()
	{
		this.fullName = "";
		this.cardNumber = "";
		this.billingAddress = "";
	}

	public CreditCard(String fullName, String cardNumber, String Billing)
	{
		this.fullName = fullName;
		this.cardNumber = cardNumber;
		this.billingAddress = Billing;
	}

	/*
	 * @author: Stephen Halm
	 * @date: Nov, 09, 2010
	 * @version 0.0.1
	 * @method last4CC
	 * @description This section of code is designed to return the last 4 digits 
	 * of a customers credit card.
	 */
	public String last4CC()
	{
		String temp;
		//need to add error testing code for this section.
		if (cardNumber == null || cardNumber.equals(""))
		{
			return "";
		}

		temp = "" + "************" + cardNumber.charAt(cardNumber.length() - 4)
				+ cardNumber.charAt(cardNumber.length() - 3)
				+ cardNumber.charAt(cardNumber.length() - 2)
				+ cardNumber.charAt(cardNumber.length() - 1);
		return temp;
	}

	/*public void CreditCard()
	{
		CreditCard();
	}*/

	public String toString()
	{
		return "fullName=" + fullName + " | cardNumber=" + cardNumber
				+ " | billingAddress=" + billingAddress;
	}

	public String getFullName()
	{
		return fullName;
	}
}
